package Controlador;

import java.awt.Color;
import java.awt.event.*;
import Vista.*;

public class MouseListenerCasillero implements MouseListener {

	private Controlador controlador;


	
	public MouseListenerCasillero(Controlador controlador){
		this.controlador = controlador;

	}

	@Override
	public void mouseClicked(MouseEvent e) {
		Casillero casillero = (Casillero)e.getSource();
		if(e.getButton()==1){
			if(this.controlador.getClickSecundarioInicial()==null){
				this.controlador.ejecutarAccionPrincipal(casillero);
			}else{
				this.controlador.desmarcarClickSecundario();
				this.controlador.desmarcarClickPrimario();
			}
			
		}
		
		
		if(e.getButton()==3){
			if(this.controlador.getClickSecundarioInicial()!=null){
				this.controlador.ejecutarAccionSecundaria(casillero);
			}else{
				this.controlador.setClickSecundarioInicial(casillero);
				casillero.setColorBorde(Color.WHITE,3);
				
			}
			
		}
		
		
	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

}
